import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
	selector: 'm-nav-tabs',
	templateUrl: './nav-tabs.component.html',
	styleUrls: ['./nav-tabs.component.scss'],
})
export class NavTabsComponent<T> implements OnInit {
	@Input() data: NavLink<T>[];
	@Input() appearance: 'tab' | 'pill' = 'tab';
	@Input() value: T;
	@Output() valueChange = new EventEmitter<T>();
	constructor() {}

	ngOnInit() {}

	change(v: T) {
		this.value = v;
		this.valueChange.emit(v);
	}
}

export interface NavLink<T = any> {
	label: string;
	link?: string; // 路由模式
	value?: T; // 选择模式
}
